package com.ssy.lingxi.pay.common;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 授信申请外部状态
 * @author 伍将
 * @date 2020/8/17 20:29
 * @version 2.0.0
 */
public enum CreditApplyOuterStatusEnum {

    /**
     * 所有
     */
    ALL(0, "所有状态", "未知操作"),
    /**
     * 待提交
     */
    WAIT_SUBMIT(1, "待提交", "提交授信申请单"),
    /**
     * 待确认
     */
    WAIT_CONFIRM(2, "待确认", "提交授信申请单"),
    /**
     * 接受申请
     */
    ACCEPT_APPLY(3, "接受申请", "审核授信申请单"),
    /**
     * 不接受申请
     */
    REFUSE_APPLY(4, "不接受申请", "审核授信申请单");

    private final Integer code;
    private final String remark;

    CreditApplyOuterStatusEnum(Integer code, String message, String remark) {
        this.code = code;
        this.remark = remark;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(),this.code);
    }

    public String getRemark() {
        return remark;
    }

    public static String getItemRemark(Integer code) {
        return Arrays.stream(CreditApplyOuterStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getRemark();
    }

    public static String getItemMessage(Integer code) {
        return Arrays.stream(CreditApplyOuterStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(ALL).getMessage();
    }
}
